package com.founder.gateway.component.transport.netty.http;

import com.founder.gateway.system.bean.ParameterMap;
import io.netty.buffer.ByteBuf;
import io.netty.handler.codec.DecoderResult;
import io.netty.handler.codec.http.*;

public class NettyHttpRequest implements FullHttpRequest {
    FullHttpRequest fullHttpRequest;
    private ParameterMap parameterMap = new ParameterMap();
    private String action;
    private String remoteAddr;

    public NettyHttpRequest(FullHttpRequest fullHttpRequest) {
        this.fullHttpRequest = fullHttpRequest;
        this.action = fullHttpRequest.uri();
    }

    @Override
    public ByteBuf content() {
        return fullHttpRequest.content();
    }

    @Override
    public HttpHeaders trailingHeaders() {
        return fullHttpRequest.trailingHeaders();
    }

    @Override
    public FullHttpRequest copy() {
        return fullHttpRequest.copy();
    }

    @Override
    public FullHttpRequest duplicate() {
        return fullHttpRequest.duplicate();
    }

    @Override
    public FullHttpRequest retainedDuplicate() {
        return fullHttpRequest.retainedDuplicate();
    }

    @Override
    public FullHttpRequest replace(ByteBuf byteBuf) {
        return fullHttpRequest.replace(byteBuf);
    }

    @Override
    public FullHttpRequest retain(int i) {
        return fullHttpRequest.retain(i);
    }

    @Override
    public int refCnt() {
        return fullHttpRequest.refCnt();
    }

    @Override
    public FullHttpRequest retain() {
        return fullHttpRequest.retain();
    }

    @Override
    public FullHttpRequest touch() {
        return fullHttpRequest.touch();
    }

    @Override
    public FullHttpRequest touch(Object o) {
        return fullHttpRequest.touch(o);
    }

    @Override
    public boolean release() {
        return fullHttpRequest.release();
    }

    @Override
    public boolean release(int i) {
        return fullHttpRequest.release(i);
    }

    @Deprecated
    @Override
    public HttpVersion getProtocolVersion() {
        return fullHttpRequest.getProtocolVersion();
    }

    @Override
    public HttpVersion protocolVersion() {
        return fullHttpRequest.protocolVersion();
    }

    @Override
    public FullHttpRequest setProtocolVersion(HttpVersion httpVersion) {
        return fullHttpRequest.setProtocolVersion(httpVersion);
    }

    @Override
    public HttpHeaders headers() {
        return fullHttpRequest.headers();
    }

    @Deprecated
    @Override
    public HttpMethod getMethod() {
        return fullHttpRequest.getMethod();
    }

    @Override
    public HttpMethod method() {
        return fullHttpRequest.method();
    }

    @Override
    public FullHttpRequest setMethod(HttpMethod httpMethod) {
        return fullHttpRequest.setMethod(httpMethod);
    }

    @Deprecated
    @Override
    public String getUri() {
        return fullHttpRequest.getUri();
    }

    @Override
    public String uri() {
        return fullHttpRequest.uri();
    }

    @Override
    public FullHttpRequest setUri(String s) {
        return fullHttpRequest.setUri(s);
    }

    @Deprecated
    @Override
    public DecoderResult getDecoderResult() {
        return fullHttpRequest.getDecoderResult();
    }

    @Override
    public DecoderResult decoderResult() {
        return fullHttpRequest.decoderResult();
    }

    @Override
    public void setDecoderResult(DecoderResult decoderResult) {
        fullHttpRequest.setDecoderResult(decoderResult);
    }

    public void replaceRequest(ByteBuf content) {
        fullHttpRequest = fullHttpRequest.replace(content);
    }

    public ParameterMap getParameterMap() {
        return parameterMap;
    }

    public String getRemoteAddr() {
        return remoteAddr;
    }

    public void setRemoteAddr(String remoteAddr) {
        this.remoteAddr = remoteAddr;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getAction() {
        return action;
    }
}
